/**
 * @author lihuanan.cn
 */
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { useI18n } from '/@/hooks/web/useI18n';
export const { t } = useI18n();

export const columns: BasicColumn[] = [
  {
    title: t('webFirst.database.desc'),
    dataIndex: 'Desc',
    width: 50,
    align: 'left',
  },
  {
    title: t('webFirst.database.connection'),
    dataIndex: 'Connection',
    width: 80,
  },
  {
    title: t('webFirst.database.dbType'),
    dataIndex: 'DbType',
    width: 50,
  },
  {
    title: t('webFirst.database.isConnection'),
    dataIndex: 'IsConnection',
    width: 40,
    editComponent: 'Switch',

    editValueMap: (value) => {
      return value ? '是' : '否';
    },
  },
  {
    title: t('webFirst.database.isExist'),
    dataIndex: 'IsExist',
    width: 40,
    editComponent: 'Switch',

    editValueMap: (value) => {
      return value ? '是' : '否';
    },
  },
];
export const searchFormSchema: FormSchema[] = [
  {
    field: 'Desc',
    component: 'Input',
    colProps: { span: 8 },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'id',
    label: '',
    component: 'Input',
    show: false,
  },
  {
    field: 'versionNo',
    label: '',
    component: 'InputNumber',
    show: false,
  },
  {
    field: 'name',
    label: t('fast.system.app.name'),
    component: 'Input',
    required: true,
  },
  {
    field: 'code',
    label: t('fast.system.app.code'),
    component: 'Input',
    componentProps: {
      placeholder: '系统自动生成',
      disabled: true,
    },
  },
  {
    field: 'sort',
    label: t('fast.system.menu.sort'),
    component: 'InputNumber',
    required: true,
    defaultValue: '9999',
  },
  {
    field: 'active',
    label: t('fast.system.app.active'),
    component: 'RadioButtonGroup',
    defaultValue: 'N',
    show: false,
    componentProps: {
      options: [
        { label: '是', value: 'Y' },
        { label: '否', value: 'N' },
      ],
    },
  },
];
